import React, { Component } from 'react';
import {Button,Icon,Layout}  from 'antd';
import {BrowserRouter as Router , Route ,Switch} from "react-router-dom";
import {Provider} from "react-redux";
import thunkMiddleware from "redux-thunk";
import createLogger from "redux-logger"
import {applyMiddleware, combineReducers, createStore, compose} from "redux";
import routes from "./config/router";
// import vinReducer from "./pages/reducer/vin-reducer";
import * as reducers from "./reducers"
import './App.css';

// const {Sider,Header,Footer,Content}=Layout;
const allReducers = combineReducers({
    ...reducers
});

const middleware = applyMiddleware(
    thunkMiddleware,
    createLogger
);

const componseEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;

const store=createStore(allReducers, componseEnhancers(middleware));

class App extends Component {

  render() {
    return (
      <div className="App">
          <Provider store={store}>
              <Router>
                  <Switch>
                      {routes.map((item , i) => <Route
                          path={item.path}
                          render={()=>(item.component)}
                          key={i}
                      />)}
                  </Switch>
              </Router>
          </Provider>
      </div>
    );
  }
}
export default App;
